import { ColumnGroupType, ColumnType } from "antd/es/table"

import { IMemberPageLabelResponse } from "@/api/member-manage/types"
import LabelUseNum from "@/components/common/labelUseNum"
import TooltipText from "@/components/common/tooltipText"

const common = (newFormat: (arg: string) => string): Record<string, ColumnGroupType<any> | ColumnType<any>> => ({
	labelName: {
		key: "labelName",
		dataIndex: "labelName",
		title: newFormat("member.label_name_to_configure"),
		width: 258,
		render: (text: string) => <TooltipText text={text} />
	},
	labelDesc: {
		key: "labelDesc",
		dataIndex: "labelDesc",
		title: newFormat("member.label_desc"),
		width: 210,
		align: "center",
		render: (text: string) => <TooltipText text={text} />
	},
	labelUsedNum: {
		key: "labelUsedNum",
		dataIndex: "labelUsedNum",
		title: newFormat("member.label_used_num"),
		width: 120,
		align: "center",
		render: (_text: string, record: IMemberPageLabelResponse) => <LabelUseNum record={record} />
	}
})

export default common
